Skip to content

fix: release the canvas backing store on unmount - #443

Merged
zplata merged 1 commit into
mainfrom
fix/issue-440-react
Sep 4, 2026
Merged

fix: release the canvas backing store on unmount#443
zplata merged 1 commit into
mainfrom
fix/issue-440-react

Conversation

@zplata

@zplata zplata commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Should address #440 to properly set width/height of an unmounting canvas to 0.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation directly addresses the leak and includes focused regression coverage.

Pull request overview

Releases canvas backing-store memory during unmount, addressing Safari memory growth.

Changes:

  • Tracks the current canvas with a stable ref and zeroes its dimensions on teardown.
  • Cancels pending intersection retest timers.
  • Adds regression tests for canvas cleanup and timer cancellation.
File summaries
File Description
src/hooks/useRive.tsx Releases canvas memory and clears teardown timers.
test/useRive.test.tsx Tests backing-store release and ref stability.
test/useRiveIntersection.test.tsx Tests intersection timer cancellation.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zplata
zplata requested a review from bodymovin September 4, 2026 19:54

@bodymovin bodymovin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zplata
zplata merged commit 93bdd6d into main Sep 4, 2026
2 checks passed
@zplata
zplata deleted the fix/issue-440-react branch September 4, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants